function formatTime(date) {
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()
  var hour = date.getHours()
  var minute = date.getMinutes()
  var second = date.getSeconds()
  return year + "年" + month + "月" + day + "日" + hour + "时" + minute + "分" + second + "秒";
}

function doHandleMonth(month) {
  var m = month;
  if (month.toString().length == 1) {
    m = "0" + month;
  }
  return m;
}

function getDay(day) {
  var today = new Date();

  var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;

  today.setTime(targetday_milliseconds); //注意，这行是关键代码

  var tYear = today.getFullYear();
  var tMonth = today.getMonth();
  var tDate = today.getDate();
  tMonth = tMonth + 1;
  return {
    year: tYear,
    month: tMonth,
    day: tDate
  };
}

function getsevenDays() {
  let sevenDays = [];
  for(let i=1; i<=7 ;i++) {
    sevenDays.push(getDay(i));
  }
  return sevenDays;
}

export const sevenDays = getsevenDays();
